pandas filter by dictionary

40

df.loc[df[filter_v.keys()].isin(filter_v.values()).all(axis=1), :]
>>> df1.loc[(df1[list(filter_v)] == pd.Series(filter_v)).all(axis=1)]
   A  B      C  D
3  1  0  right  3

Comments

Submit
0 Comments